package org.chen.model.repository;

import org.chen.model.domain.Role;
import org.springframework.data.jpa.repository.JpaRepository;
import org.springframework.data.jpa.repository.Query;
import org.springframework.stereotype.Repository;

import java.util.List;

/**
 * @Author: 陈亮
 * @Date: 2019/3/24 17:16
 */
@Repository
public interface RoleRepository extends JpaRepository<Role, Integer> {

    @Query(value = "SELECT r.id,r.name,r.ename,r.del_flag,r.remarks FROM sys_user_role ur JOIN sys_role r ON ur.role_id = r.id WHERE ur.user_id = ?1", nativeQuery = true)
    List<Role> findRoleByAccountId(Integer id);
}
